<template>
    <BaseEcharts :chatsOption="chatsOption"></BaseEcharts>
</template>

<script>
    import BaseEcharts from "../../../components/common/Cahrts/coreEcharts"

    export default {
        components: {
            BaseEcharts
        },
        data(){
            let data =  [
                {
                    name: '公安局系统',
                    // des: 'nodedes01',
                    symbolSize: 30,
                    category:0,
                    label:{
                        normal:{
                            show: true
                        }
                    }
                    // category: 0,
                },
                {
                    name: '计生委系统',
                    // des: 'nodedes02',
                    category:1,
                    symbolSize: 50,
                    // category: 1,
                    label:{
                        normal:{
                            show: true
                        }
                    }
                },
                {
                    name: '商务局系统',
                    // des: 'nodedes3',

                    symbolSize: 50,
                    category: 2,
                    label:{
                        normal:{
                            show: true
                        }
                    }
                },
                {
                    name: '气象局系统',
                    // des: 'nodedes04',
                    symbolSize: 50,
                    category: 1,
                    label:{
                        normal:{
                            show: true
                        }
                    }
                },
                {
                    name: '农林局系统',
                    // des: 'nodedes05',
                    symbolSize: 50,
                    category: 1,
                    label:{
                        normal:{
                            show: true

                        }
                    }
                }];


            let link  =  data.reduce((pre,ele)=>{
                data.forEach((item,index)=>{
                    if(ele.name != item.name){
                        pre.push(
                            {
                                source: ele.name,
                                target: item.name,
                                name: null,
                            }
                        )
                    }
                });
                return pre
            },[]);
            let categories = data.map(ele => {
                return {}
            });
            return {
                chatsOption: {
                    color:["#FBDD60","#FD6E77","#57D9FA","#05C192","#FC8B44","#8B48E4","#DA7AFF","#4992FF",],
                    tooltip: {
                        show:false,
                    },
                    animationDurationUpdate: 1500,
                    animationEasingUpdate: 'quinticInOut',
                    circular: {
                        rotateLabel: true
                    },
                    series: [
                        {
                            name: 'Les Miserables',
                            type: 'graph',
                            layout: 'circular',
                            left:"12%",
                            right:"12%",
                            top:"12%",
                            bottom:"12%",
                            circular: {
                                rotateLabel: true
                            },
                            data:data,

                            links:link,
                            roam: false,
                            label: {
                                fontSize:20,
                            },
                            categories:categories,
                            lineStyle: {
                                color: 'source',
                                width:3,
                                curveness: 0.3
                            }
                        }
                    ]
                }
            }
        },


    }
</script>
